﻿{template 'web/_header'}
{template 'web/allorder/common_search'}
{template 'web/allorder/normal_tabs'}
<style type='text/css'>

       .trhead td {  background:#efefef;text-align: center}

       .trbody td {  text-align: center; vertical-align:top;border-left:1px solid #ccc;}

</style>
        <table class='table' style='float:left;border:1px solid #ccc;margin-bottom:5px;table-layout: fixed'>

                <tr class='trhead'>

                    <td colspan='3'  style='text-align:left;'>订单数: {$total} 订单金额:

                    {if !empty($agentid)}总佣金: {$totalcommission}

                    {else}总购买积分: {$totalcredit}

                    {/if}

                    </td>

                    <td >规格及编码</td>

                    <td >单价(元)</td>

                    <td >数量</td>

                    <td >买家</td>

                    <td >支付方式</td>

                    <td>配送方式</td>

                    <td >价格</td> 

                    {if !empty($agentid)}

                    <td>返佣体现</td>

                    {else}

                    <td>赠送积分</td>

                    {/if}            

                    <td  >状态</td>

                    <td>操作</td>

                </tr>

            </table>

                {loop $list $item}
    <table class='table' style='float:left;border:1px solid #ccc;margin-top:5px;margin-bottom:5px;table-layout: fixed;'>
                <tr >

                    <td colspan='12'  style='border-bottom:1px solid #ccc;background:#efefef;'> 

                        <b>订单编号:</b>  {$item['ordersn']}     

                        <b>下单时间:  </b>{php echo date('Y-m-d H:i:s', $item['createtime'])}

                        {if $item['TotalId'] >1 }

                        <label class='label label-danger'>子订单</label>

                        <label class='label label-danger'>总订单ID:{php echo $item['TotalId'];}</label>

                        {/if}
                        {if $item['TotalId'] == 1 }

                        <label class='label label-danger'>总订单 ID:{php echo $item['id'];}</label>

                        <label class='label label-danger'></label>

                        {/if}
                        {if $_GPC['status']==6}
                        <label class='label label-danger'>店铺名称：{php echo $item['shopname'];}</label>
                        {/if}
                         {if !empty($item['refundid'])}<label class='label label-danger'>退款申请</label>{/if}

                    <td style='border-bottom:1px solid #ccc;background:#efefef;text-align: center' >

                          {if empty($item['statusvalue'])}

                            {ifp 'order.op.close'}

                                  <a class="btn btn-default btn-sm" href="javascript:;" onclick="$('#modal-close').find(':input[name=id]').val('{$item['id']}')" data-toggle="modal" data-target="#modal-close">关闭订单</a>

                            {/if}

                            {elseif $item['statusvalue'] == 1}
								{ifp 'order.op.close'}
                                  <a class="btn btn-default btn-sm" href="javascript:;" onclick="$('#modal-close').find(':input[name=id]').val('{$item['id']}')" data-toggle="modal" data-target="#modal-close">关闭订单</a>
								{/if}
                            {/if}

                    </td>

                </tr>

                {loop $item['goods'] $k $g}

                <tr class='trbody'>

                    <td valign='top'  colspan='3' style='border-left:none;text-align: left;' style='width:200px;'>

                        <a href="{php echo $this->createWebUrl('shop/goods', array('id' => $g['id'], 'op' => 'post'))}"><img src="{php echo tomedia($g['thumb'])}" style="width: 50px; height: 50px;border:1px solid #ccc;padding:1px;"> 

                        {$g['title']}

                        </a> 

                    </td>

                    <td style='border-left:none'>{if !empty($g['optiontitle'])}<span class="label label-primary">{$g['optiontitle']}</span>{/if}

                        <br/>{$g['goodssn']}</td>

                    <td style='border-left:none'>原价: {php echo $g['price']/$g['total']} <br/>折后: {php echo $g['realprice']/$g['total']}</td>

                    <td style='border-left:none'>{$g['total']}</td>

                    {if $k==0}

                    <td rowspan="{php echo count($item['goods'])}" > {$item['realname']}<br/>{$item['mobile']}</td>

                    <td rowspan="{php echo count($item['goods'])}" ><label class='label label-{$item['css']}'>{$item['paytype']}</label></td>

                    <td  rowspan="{php echo count($item['goods'])}">{$item['dispatchname']}</td>

                    <td style='text-align:right;'  rowspan="{php echo count($item['goods'])}">{$item['price']} 元<br/>运费: {$item['dispatchprice']} 元

                    {if $item['deductprice']>0}

                    <br/>积分抵扣: {$item['deductprice']} 元

                    {/if}

                    {if $item['deductcredit2']>0}

                    <br/>余额抵扣: {$item['deductcredit2']} 元

                    {/if}
                    {if $item['gift_card']>0}
                    <br/>礼品抵扣: {$item['gift_card']} 元
                    {/if}
                    {if $item['deductenough']>0}

                    <br/>满额立减: {$item['deductenough']} 元

                    {/if}

                    {if $item['youhuiquan']>0}

                    <br/>优惠券: {$item['youhuiquan']} 元

                    {/if}

                    </td>

                    {if !empty($agentid)}

                    <td>{$item['commission']}元</td>

                    {else}

                    <td>{$item['credit']}</td>

                    {/if}

                    <td   rowspan="{php echo count($item['goods'])}" ><label class='label label-{$item['statuscss']}'>{$item['status']}</label><br />

                    <a href="{php echo $this->createWebUrl('allorder', array('op' => 'detail', 'id' => $item['id']))}" >查看详情</a></td>

                            <td   rowspan="{php echo count($item['goods'])}" >
                           {template 'web/allorder/normal_ops'}
                            </td>

                                       {/if} 

                </tr>

                {/loop}

   </table>


            {/loop}

                    {$pager}
         {template 'web/allorder/normal_modals'}

        {template 'web/_footer'}

